import sys
from PySide2.QtWidgets import QApplication
from fram_less_window import FrameLessWindow


import sys
from PySide2.QtWidgets import QApplication
from PySide2.QtCore import Qt
from fram_less_window import FrameLessWindow

class MainWindow(FrameLessWindow):
    def __init__(self) -> None:
        super().__init__()
        self.closeButton.clicked.connect(self.close) # Connect close button to self.close() method.
        self.winMaxButton.clicked.connect(self.maximize_restore_window) # Connect Maximize button to self.showMaximized().
        self.winfoButton.clicked.connect(self.showMinimized) # Connect info button to self.showMinimized().
        self.pushPinButton.clicked.connect(self.pin_window) # Connect pin button to self.pin_window().

    def pin_window(self):
        if self.windowFlags() & Qt.WindowStaysOnTopHint:
            self.setWindowFlag(Qt.WindowStaysOnTopHint, False)
        else:
            self.setWindowFlag(Qt.WindowStaysOnTopHint, True)
        self.show()

    def maximize_restore_window(self):
        if self.isMaximized():
            self.showNormal()
        else:
            self.showMaximized()
            
if __name__ == '__main__':
    app = QApplication(sys.argv)
    mainWindows = MainWindow()
    mainWindows.show()
    app.exec_()
